/*
 * Copyright (c) 2024-2025 iSOFT INFRASTRUCTURE SOFTWARE CO., LTD.
 * easyAda is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#ifndef STDINT_H
#define STDINT_H

#include <plat/config.h>
#include <stdlib/stddef.h>

#ifdef __INT64_TYPE__
#define __INT64 __INT64_TYPE__
#else
#define __INT64            __int64
#define __INT64_C_SUFFIX__ ll
#endif

typedef signed char  int8_t;
typedef signed short int16_t;
typedef signed int   int32_t;
typedef signed long  int64_t;

typedef unsigned char  uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int   uint32_t;
typedef unsigned long  uint64_t;

typedef signed char      int_least8_t;
typedef signed short int int_least16_t;
typedef signed int       int_least32_t;
typedef signed __INT64   int_least64_t;

typedef unsigned char      uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int       uint_least32_t;
typedef unsigned __INT64   uint_least64_t;

typedef signed int     int_fast8_t;
typedef signed int     int_fast16_t;
typedef signed int     int_fast32_t;
typedef signed __INT64 int_fast64_t;

typedef unsigned int     uint_fast8_t;
typedef unsigned int     uint_fast16_t;
typedef unsigned int     uint_fast32_t;
typedef unsigned __INT64 uint_fast64_t;

typedef signed __INT64   intmax_t;
typedef unsigned __INT64 uintmax_t;

#define INT8_C(x)  (x)
#define INT16_C(x) (x)
#define INT32_C(x) (x)
#define INT64_C(x) __INT64_C(x)

#define UINT8_C(x)  (x##u)
#define UINT16_C(x) (x##u)
#define UINT32_C(x) (x##u)
#define UINT64_C(x) __UINT64_C(x)

typedef unsigned long intptr_t;
typedef unsigned long uintptr_t;

typedef signed       ptr_t;
typedef signed const const_ptr_t;

typedef unsigned long word_t;
typedef unsigned long cptr_t;

typedef unsigned func_t;
typedef unsigned printf_func_t;

typedef char bool_t;

#define UINT32_MAX (0XFFFFFFFFU)
#define UINT64_MAX (0XFFFFFFFFFFFFFFFFULL)
#define BIT(n)     (1UL << (n))

#ifdef CONFIG_ARCH_32

typedef long long          int64_t;
typedef unsigned long long uint64_t;
typedef unsigned int       intptr_t;
typedef unsigned long      word_t;

#else
#endif

#endif
